Ext.define('appfe.stockor.exec.form.ExecHoldMonitorEditFormController', {
    extend: 'Ext.app.ViewController',
    alias: 'controller.stockor.exec.form.ExecHoldMonitorEditForm',

    submitForm: function () {

        var myview = this.getView();
        //判断form是否处于有效状态, 即各个需要验证的field是否通过了验证
        if (!myview.getForm().isValid()) {
            Ext.MessageBox.alert('信息提示', '表单验证未通过, 请检查必填项');
            return;
        }
        var myviewmodel = myview.getViewModel();
        var isValidSlimsymbol = myviewmodel.get('isValidSlimsymbol');
        if (!isValidSlimsymbol) {
            Ext.MessageBox.alert('信息提示', '股票代码验证未通过, 请填写有效股票代码');
            return;
        }
        var parentItemId = myviewmodel.get('parentItemId');
        var myctrler = myview.getController();

        myview.getForm().submit({
            clientValidation: true,
            submitEmptyText: false,
            disabled: true,
            waitMsg: '提交中...',
            url: BizHttpAction.updateMonitor2StockHold4Sellout.url,
            method: BizHttpAction.updateMonitor2StockHold4Sellout.method,
            // params: {
            //     actionType: myviewmodel.get('actionType')
            // },
            success: function (form, action) {
                Ext.getCmp(parentItemId).getController().search();
                myctrler.closeWin();
            },
            failure: function (form, action) {
                console.debug("action", action);
                var alertMsg;
                if (action.result && action.result.message) {
                    alertMsg = action.result.message;
                } else {
                    alertMsg = '操作失败, 请联系系统管理员'
                }
                Ext.Msg.alert('操作失败', alertMsg, function () {
                });
            }
        });

    },
    closeWin: function() {
        Ext.WindowManager.getActive().close();
    }
});